package bravo.xc.com.xc_bravo_android.base;

/**
 * CREATED BY YANK
 * DATE : 2017/10/22
 * MAIL : YANK.TENYOND@GMAIL.COM
 * FUNCTION :
 */

public abstract class BaseMVPActivity<V extends BaseView, P extends BasePresenter<V>> extends BaseActivity{

    protected P presenter;

    protected abstract P createPresnter();

    @Override
    protected void init() {
        this.presenter = createPresnter();
        this.presenter.onBinded((V) this);
        super.init();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if(presenter!=null){
            presenter.onDetached();
        }
    }
}
